export default {
    data() {
        return {
            currPage: 1,
            totalCount: 0,
            pageSize: 10,
            tableData: [],
            searchInfo: {}
        }
    },
    methods: {
        handleSizeChange(val) {
            this.pageSize = val
            this.getTableData()
        },
        handlepageChange(val) {
            this.currPage = val
            this.getTableData()
        },
        async getTableData(currPage = this.currPage, pageSize = this.pageSize) {
            const table = await this.listApi({ currPage, pageSize, ...this.searchInfo })
            if (!Array.isArray(table.data)) {
                this.tableData = table.data.data
                this.totalCount = table.data.totalCount
                this.currPage = table.data.currPage
                this.pageSize = table.data.pageSize
                this.$forceUpdate()
            } else{
                this.tableData = []
                this.tableData = table.data
            }
            // console.log(this.tableData)
            
        }
    }
}